/*
 * Copyright 2012 Faculty of Informatics - Masaryk University.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cz.muni.fi.pa165.creatures.model;

import java.io.Serializable;

/**
 * This class represents key in the many-to-many association table.
 * 
 * @author smikloso
 */
public class CreatureTypeWeaponId implements Serializable {
    
    private static final long serialVersionUID = -2781896378487191942L;
    
    private Long creatureType;
    
    private Long weapon;
    
    public Long getCreatureType() {
        return creatureType;
    }
    
    public void setCreatureType(Long creatureType) {
        this.creatureType = creatureType;
    }

    public Long getWeapon() {
        return weapon;
    }
    
    public void setWeapon(Long weapon) {
        this.weapon = weapon;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 83 * hash + (this.creatureType != null ? this.creatureType.hashCode() : 0);
        hash = 83 * hash + (this.weapon != null ? this.weapon.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final CreatureTypeWeaponId other = (CreatureTypeWeaponId) obj;
        if (this.creatureType != other.creatureType 
                && (this.creatureType == null || !this.creatureType.equals(other.creatureType))) {
            return false;
        }
        if (this.weapon != other.weapon 
                && (this.weapon == null || !this.weapon.equals(other.weapon))) {
            return false;
        }
        return true;
    }
    
}
